<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <!--引入Vue-->
  <script type="text/javascript" src="../js/vue.js"></script>
  <title>计算属性_简写</title>
</head>
<body>
  <!--准备好一个容器-->
  <div id="root">
    姓：<input type="text" v-model="firstName"><br/><br/>
    名：<input type="text" v-model="lastName"><br/><br/>
    <!--缺点：{{}}里面会太繁琐-->
    姓名:<span>{{fullName}}</span>
  </div>


  <script type="text/javascript">
    Vue.config.productionTip=false;
    new Vue({
      el:'#root',
      data:{
        firstName:'',
        lastName:''
      },
      computed:{
        //简写
        fullName(){
          console.log('get被调用了')
          return this.firstName+'-'+this.lastName
        }
      }

    })
  </script>
</body>
</html>